const prev = (that, id, name, data) => {
  id -= 1;
  if (id <= 0) {
    wx.showToast({
      title: "已经到头了...",
      icon: "none",
    });
  } else {
    let myList = [data[id - 1]];
    that.setData({
      drawerActive: id,
      myList
    });
    wx.setStorageSync(name + 'id', id);
  }
};

const next = (that, id, name, data) => {
  id += 1;
  if (id >= data.length + 1) {
    wx.showToast({
      title: "没有更多了...",
      icon: "none",
    });
  } else {
    let myList = [data[id - 1]];
    that.setData({
      drawerActive: id,
      myList
    });
    wx.setStorageSync(name + 'id', id);
  }
};

module.exports = {
  prev,
  next
}